package com.touzhijia.authority.mapper;

import com.touzhijia.authority.domain.dto.request.PermissionQueryByRoleReq;
import com.touzhijia.authority.domain.dto.request.PermissionQueryReq;
import com.touzhijia.authority.domain.dto.response.PermissionByRoleRes;
import com.touzhijia.authority.domain.entity.Permission;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 作者： lzw<br/>
 * 创建时间：2018-03-14 17:05 <br/>
 */
public interface PermissionMapper extends Mapper<Permission> {

    Permission getByPermission(@Param("permission") String permission);

    List<Permission> findPermission(PermissionQueryReq queryReq);

    List<PermissionByRoleRes> findPermissionByRole(PermissionQueryByRoleReq queryReq);

    List<String> getAllModule();

    List<Permission> findUserAllPermission(@Param("username") String username);

    List<Permission> findUserAllPermissionByModule(@Param("username") String username, @Param("module") String module);

    int existsPermissionByUser(@Param("username") String username, @Param("permission") String permission);

    List<Permission> findPermissionByModule(@Param("module") String module);

    int deleteByPermission(@Param("permission") String permission);
}
